package com.study.design.model.structPattern.proxy.dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
* @Name: StarHandle
* @Description: 代理角色：明星代理类
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-2-10 下午9:06:45 
* @Version: V1.0
 */
public class StarHandle implements InvocationHandler {
	
	private RealStar realStar ;
	
	public StarHandle(RealStar realStar) {
		this.realStar = realStar;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		Object result = null ;
		System.out.println("唱歌前期准备，代理明星进行处理：面谈、签合同、订机票！");
		if(method.getName().equals("sing")) {
			result = method.invoke(realStar, args) ;
		}
		System.out.println("唱歌后，代理明星进行处理：收钱！");
		return result;
	}

}







